<template>
    <div class="box">
        <h4>授权页</h4>
        <input type="button" value="返回上一个路由" @click=" $router.back() ">
    </div>
</template>

<script>
export default {
    beforeRouteEnter(to,from,next){
        let token = sessionStorage.getItem("token")
        if(token){
            next();
        }else{
            // next(false);
            next({
                name:"login",
                params:{
                    msg:"请先登录",
                    path:"token"
                }
            })
        }
    }
}
</script>

<style scoped>
.box{
    min-height: 400px;
    border: 4px dashed #ccc;
}
</style>